// nodes/TaskNode.js
import { RectNode, RectNodeModel } from '@logicflow/core'

class TaskNodeModel extends RectNodeModel {
  initNodeData(data) {
    super.initNodeData(data)
    this.width = 120
    this.height = 60
    this.text = data.text || '工序'
    this.properties = {
      ...data.properties,
      duration: data.properties?.duration || '1天',
      worker: data.properties?.worker || ''
    }
  }
  
  getNodeStyle() {
    const style = super.getNodeStyle()
    style.fill = '#f5f5f5'
    style.stroke = '#1890ff'
    style.radius = 5
    return style
  }
}

class TaskNodeView extends RectNode {}

export default {
  type: 'task-node',
  view: TaskNodeView,
  model: TaskNodeModel
}